﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NHibernateBusiness.Data;
using Model;
using System.Data;

namespace DataDeal
{
    public class DictionaryDAL
    {
        private INHibernateHelper _helper;

        public DictionaryDAL()
        {
            _helper = NHibernateFactory.Instance.GetDataHandler();
        }

        public DataSet GetQueryByTypeIdForDs(string typeId)
        {
            return _helper.GetQueryForDs<Dictionary>("TypeId", typeId);
        }

        public IList<Dictionary> GetQueryByTypeId(string typeId)
        {
            return _helper.GetQuery<Dictionary>("TypeId", typeId);
        }
        public IList<Dictionary> GetQueryByTypeName(string name)
        {
            return _helper.GetQuery<Dictionary>("TypeName", name);
        }
        public void Save(Dictionary entity)
        {
            _helper.Save(entity);
        }
        public void Update(Dictionary entity)
        {
            _helper.Update(entity);
        }

        public void Delete(Dictionary entity)
        {
            _helper.Delete<Dictionary>(entity);
        }

        public void Delete(string Id)
        {
            _helper.Delete(string.Format("delete from Dictionary where Id='{0}'",Id));
        }
    }
}
